package Solutions

import "unsafe"

func originalDigits(s string) string {
	count := make([]int, 26)
	for i := 0; i < len(s); i++ {
		count[s[i]-'a']++
	}
	num := make([]int, 10)
	num[6] = count['x'-'a']
	num[0] = count['z'-'a']
	num[2] = count['w'-'a']
	num[7] = count['s'-'a'] - num[6]
	num[5] = count['v'-'a'] - num[7]
	num[4] = count['f'-'a'] - num[5]
	num[3] = count['r'-'a'] - num[4] - num[0]
	num[8] = count['h'-'a'] - num[3]
	num[9] = count['i'-'a'] - num[8] - num[6] - num[5]
	num[1] = count['o'-'a'] - num[2] - num[0] - num[4]
	ans := make([]byte, 0, 16)
	for i := 0; i < 10; i++ {
		for j := 0; j < num[i]; j++ {
			ans = append(ans, '0'+byte(i))
		}
	}
	return *(*string)(unsafe.Pointer(&struct {
		Data uintptr
		Len  int
	}{
		uintptr(unsafe.Pointer(&ans[0])),
		len(ans),
	}))

}

//zero
// one
// two
// three
// four
// five
// six
// seven
// eight
// nine
// ten
